package com.wuliu.servlet;

import com.wuliu.dao.BusinessDAO;
import com.wuliu.dao.impl.BusinessDAOImpl;
import com.wuliu.model.Business;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.List;

@WebServlet("/admin/business")
public class AdminBusinessServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        BusinessDAO businessDAO =new BusinessDAOImpl();
        List<Business> businesses=businessDAO.findAllAndClass();
        req.setAttribute("businesses",businesses);
        req.getRequestDispatcher("/WEB-INF/view/admin/business.jsp").forward(req,resp);
    }
}
